/*
 *  @ProductName@
 *  Copyright (C) @CopyrightYear@
 *    National Institute of Advanced Industrial Science and Technology (AIST)
 *    Registration Number: @AISTRegistrationNumber@
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package jp.go.aist.six.vuln.model.scap.cvss;

import java.io.Serializable;
import java.util.HashMap;




/**
 *
 * @author	Akihito Nakamura, AIST
 * @version $Id: CiaType.java 6 2010-05-15 10:00:19Z nakamura5akihito $
 */
public final class CiaType
    implements Serializable
{

    private static final String  _NONE_      = "NONE";
    private static final String  _PARTIAL_   = "PARTIAL";
    private static final String  _COMPLETE_  = "COMPLETE";


    public static final CiaType  NONE      = new CiaType( _NONE_ );
    public static final CiaType  PARTIAL   = new CiaType( _PARTIAL_ );
    public static final CiaType  COMPLETE  = new CiaType( _COMPLETE_ );



    private static HashMap<String, CiaType> _INIT_()
    {
        HashMap<String, CiaType>  map = new HashMap<String, CiaType>();
        map.put( _NONE_,      NONE     );
        map.put( _PARTIAL_ ,  PARTIAL  );
        map.put( _COMPLETE_,  COMPLETE );
        return map;
    }

    private static final HashMap<String, CiaType>  _INSTANCES_ = _INIT_();




    /**
     */
    public static CiaType valueOf(
                    final String name
                    )
    {
        CiaType  flag = null;
        if (name != null) {
            flag = _INSTANCES_.get( name );
        }

        if (flag == null) {
            throw new IllegalArgumentException( "invalid cia type: " + name );
        }

        return flag;
    }



    private String  _name = null;



    /**
     */
    private CiaType(
                    final String name
                    )
    {
        _name = name;
    }


    /**
     */
    public String getName()
    {
        return _name;
    }



    //**************************************************************
    //  java.lang.Object
    //**************************************************************

    @Override
    public String toString()
    {
        return getName();
    }

}
// CiaType
